package com.bawei.module_home.http

import com.bawei.lib_net.BaseResponse
import com.bawei.module_home.model.AddAreaModel
import com.bawei.module_home.model.AddMerchantBody
import com.bawei.module_home.model.AreaDetailModel
import com.bawei.module_home.model.AreaModelItem
import com.bawei.module_home.model.DeviceModel
import com.bawei.module_home.model.MerchantModelItem
import com.bawei.module_home.model.HouseItem
import com.bawei.module_home.model.NewsBody
import com.bawei.module_home.model.NewsModelItem
import com.bawei.module_home.model.NoticeModelItem
import com.bawei.module_home.model.ProfilesModelItem
import com.bawei.module_home.model.RepairModel
import com.bawei.module_home.model.SignParam
import com.bawei.module_home.model.SignResult
import com.bawei.module_home.model.VipModel
import com.bawei.module_home.model.VisitorBody
import com.bawei.module_home.model.VisitorData
import com.bawei.module_home.model.VisitorListData
import com.bawei.module_home.model.VisitorListModel
import com.bawei.module_home.model.addAreaBody
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.PATCH
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query

interface Api {

    @GET("api/announcements")
    suspend fun getServiceList(@Query("page")page:Int,@Query("size")size:Int): BaseResponse<List<NoticeModelItem>>

    @GET("/api/parking-spaces/area/{areaId}")
    suspend fun getAreaList(@Path("areaId")areaId: Int): BaseResponse<List<AreaModelItem>>


    @POST("/api/devices")
    suspend fun insertDevice(@Body body: DeviceModel): BaseResponse<DeviceModel>

    @GET("/api/devices/{id}")
    suspend fun getDeviceDetail(@Path("id")id: Int): BaseResponse<DeviceModel>

    @POST("/api/parking-spaces")
    suspend fun addArea(@Body body: addAreaBody): BaseResponse<AddAreaModel>

    //会员接口
    @GET("/memberships/{userId}")
    suspend fun getVip(@Path("userId")userId:Int): VipModel

    @DELETE("/api/parking-spaces/{id}")
    suspend fun deleteArea(@Path("id")id: Int): BaseResponse<Boolean>

    @GET("/api/parking-spaces/{id}")
    suspend fun areaDetail(@Path("id")id: Int): BaseResponse<AreaDetailModel>

    //升级会员
    @PUT("/memberships/{userId}/upgrade")
    suspend fun put_upgrade(@Path("userId")userId:Int, @Query("newMembershipLevel")newMembershipLevel:String): VipModel

    //签到接口
    @POST("/api/attendances")
    suspend fun postSign(@Body signParam: SignParam):BaseResponse<SignResult>

    @GET("/api/devices")
    suspend fun getDeviceList(): BaseResponse<List<DeviceModel>>
    //来访预约
    @POST("/api/visit-appointments")
    suspend fun addVisitor(@Body body: VisitorBody): BaseResponse<VisitorData>
    //访客管理
    @GET("/api/visit-appointments")
    suspend fun getVisitor():BaseResponse<List<VisitorListData>>
    //物业保修
    @POST("/api/repair-orders")
    suspend fun postRepair(@Body body: RepairModel):BaseResponse<RepairModel>

    //入驻
    @GET("/api/merchant-applications")
    suspend fun getMerchant(): BaseResponse<List<MerchantModelItem>>

    @GET("/api/merchant-applications/{id}")
    suspend fun getMerchantDetail(@Path("id")id: Int): BaseResponse<MerchantModelItem>
    @POST("/api/merchant-applications")
    suspend fun addMerchant(@Body body: AddMerchantBody): BaseResponse<MerchantModelItem>
    @PATCH("/api/merchant-applications/approve/{id}")
    suspend fun approveMerchant(@Path("id")id: Int): BaseResponse<MerchantModelItem>

    //获取所有房源
    @GET("/api/properties")
    suspend fun getAllHouse(): BaseResponse<List<HouseItem>>
    //获取状态
    @GET("/api/properties/region/{regionId}")
    suspend fun getHouse2(@Path("regionId")regionId:Int):BaseResponse<List<HouseItem>>





    @PATCH("/api/devices/modifyStatus")
    suspend fun postDeviceStatus(@Query("id")id: Int,@Query("status")status: String): BaseResponse<DeviceModel>

    @DELETE("/api/devices/{id}")
    suspend fun deleteDevice(@Path("id")id: Int): BaseResponse<Boolean>


    //公司
    @GET("/api/enterprise-profiles")
    suspend fun getProfiles(): BaseResponse<List<ProfilesModelItem>>
    //公司详情
    @GET("/api/enterprise-profiles/{id}")
    suspend fun getProfilesDetail(@Path("id")id: Int): BaseResponse<ProfilesModelItem>




    @GET("/api/attendances/user/{userId}")
    suspend fun getSignList(@Path("userId")userId: Int): BaseResponse<List<SignResult>>

    @GET("/api/news")
    suspend fun getNews(): BaseResponse<List<NewsModelItem>>

    @POST("/api/news")
    suspend fun sendNews(@Body body: NewsBody): BaseResponse<NewsModelItem>

}